TASK_DIR:=$(dir $(abspath $(lastword $(MAKEFILE_LIST))))

include ../../config.mk

# Inputs
BCA_MODELS := $(TASK_DIR)/../../run_benefit_cost_regressions/output/reg_results.feather
PAYROLL_STIPEND := $(TASK_DIR)/../gen_payroll_outputs/output/combined_wage_table.csv
CONFIG_FILE := $(TASK_DIR)/hand/config.yaml

# One of the outputs
OUT_FILE := $(OUT_DIR)/outcomes_benefit_cost_up_to_date.tex

$(OUT_FILE): $(RMD_FILE) $(CONFIG_FILE) $(BCA_MODELS) $(PAYROLL_STIPEND) $(TASK_FNS)
	@mkdir -p $(OUT_DIR)
	@mkdir -p $(PAPER_OUT_DIR)
	$(R_script) -e "rmarkdown::render(input = '$(RMD_FILE)')"
	@cp $(OUT_DIR)/*up_to_date.tex $(PAPER_OUT_DIR)

.PHONY: all clean
.DEFAULT_GOAL=all

all: $(OUT_FILE)

clean:
	rm -rf $(OUT_DIR)/*up_to_date*
